﻿using Senparc.Weixin.MP.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Weixin.Core.config;
using Weixin.Core.Model;

namespace Weixin.Core
{
    public class WxJsSdk
    {
        /// <summary>
        /// 微信授权链接
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static WxJsSdkResult GetJsSdkUiPackage(string url)
        {

            WxJsSdkResult wxJsSdkResult = new WxJsSdkResult();


            var jsSdk = JSSDKHelper.GetJsSdkUiPackage(WxConfig.AppId, WxConfig.AppSecret, url);
            wxJsSdkResult.timestamp = jsSdk.Timestamp;
            wxJsSdkResult.nonceStr = jsSdk.NonceStr;
            wxJsSdkResult.signature = jsSdk.Signature;
            wxJsSdkResult.appId = jsSdk.AppId;

            return wxJsSdkResult;

        }

    }
}
